import { Entity, Column, PrimaryGeneratedColumn, UpdateDateColumn, ManyToOne, JoinColumn, OneToMany } from 'typeorm';
import { ApiProperty} from '@nestjs/swagger';
import { Goods } from './goods.entity';
import { IsOptional } from 'class-validator';

@Entity()
export class Brand {
  @PrimaryGeneratedColumn({type: 'int'})
  id: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'varchar' ,length: 255})
  name:string;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'varchar' ,length: 255})
  list_pic_url:string;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'varchar' ,length: 255})
  simple_desc:string;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'varchar' ,length: 255})
  pic_url:string;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'tinyint' ,width: 3 })
  sort_order: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'tinyint' ,width: 1 })
  is_show: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'tinyint' ,width: 1 })
  is_new: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'decimal' ,width: 10 })
  floor_price: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'varchar', length: 255})
  app_list_pic_url: string;

  @OneToMany(type => Goods, goods => goods.brand)
  goods: Goods[]
}
